﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;


namespace Jemgine.MapEditor.Operations
{
	internal class ReversePolygon : Operation
	{
        Engine.Selection Selected;
        Data.EditorPolygon Polygon;

        internal ReversePolygon(Engine.Selection Selected)
        {
            this.Selected = Selected;
        }

        internal override ReturnCode Do(EditorState ES)
        {
            Polygon = ES.GetSelectionObject(Selected) as Data.EditorPolygon;
            if (Polygon == null) return ReturnCode.DoNotAddToUndoStack;
            Polygon.Reverse();
            ES.OnInvalidateMap();
            return ReturnCode.AddToUndoStack;
        }

		internal override void Undo(EditorState ES)
		{
            Polygon.Reverse();
            ES.OnInvalidateMap();
        }



	}
}
